package org.liulinlin.sejw.db;

import java.sql.*;

public class GoodsNum { //extends DataAccessServiceImpl {
	private String id;
	private int gp20;
	private int gp20Details;
	private int gp40;
	private int gp40Details;
	private int hq40;
	private int hq40Details;
	private int cbm;
	
	public GoodsNum() {
		
	}
	public GoodsNum(String id) {
		DBConnectionManager connMgr = DBConnectionManager.getInstance();
		Connection con = connMgr.getConnection("shipping_export");
		if (con == null) {
			System.out.println("不能获得数据库连接");
			return;
		}
		
		try {
			Statement stmt = con.createStatement();
			ResultSet rs = stmt.executeQuery("select * from GoodsNum where GN_ID = '" + id + "'");
		
			rs.next();
			this.id = id;
			gp20 = rs.getInt("GN_20GP");
			gp20Details = rs.getInt("GN_20GPDetails");
			gp40 = rs.getInt("GN_40GP");
			gp40Details = rs.getInt("GN_40GPDetails");
			hq40 = rs.getInt("GN_40HQ");
			hq40Details = rs.getInt("GN_40HQDetails");
			cbm = rs.getInt("GN_CBM");
			
			rs.close();
			stmt.close();
		} catch(SQLException e) {
			e.printStackTrace();
		}
		
		connMgr.freeConnection("shipping_export", con);
		connMgr.release();
	}
	
	public void setId(String id) {
		this.id = id;
	}
	public void setGP20(int gp20) {
		this.gp20 = gp20;
	}
	public void setGP20Details(int gp20Details) {
		this.gp20Details = gp20Details;
	}
	public void setGP40(int gp40) {
		this.gp40 = gp40;
	}
	public void setGP40Details(int gp40Details) {
		this.gp40Details = gp40Details;
	}
	public void setHQ40(int hq40) {
		this.hq40 = hq40;
	}
	public void setHQ40Details(int hq40Details) {
		this.hq40Details = hq40Details;
	}
	public void setCBM(int cbm) {
		this.cbm = cbm;
	}
	
	public String getId() {
		return id;
	}
	public int getGP20() {
		return gp20;
	}
	public int getGP20Details() {
		return gp20Details;
	}
	public int getGP40() {
		return gp40;
	}
	public int getGP40Details() {
		return gp40Details;
	}
	public int getHQ40() {
		return hq40;
	}
	public int getHQ40Details() {
		return hq40Details;
	}
	public int getCBM() {
		return cbm;
	}
}
